package strings.exercise;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by cody on 16/1/13.
 */
public class Exercise11 {

    public static void main(String[] args) {
        String inputString = "Airline are eight apples and one orange while Anita hadn't any";
        String regularString = "(?i)((^[aeiou])|(\\s+[aeiou]))\\w+?[aeiou]\\b";
        Pattern pattern = Pattern.compile(regularString);
        Matcher matcher = pattern.matcher(inputString);
        int i = 0;
        while (matcher.find()) {
            System.out.println((++i) + ". Match " + matcher.group() + " at positions " + matcher.start() + "-" + matcher.end());
        }
    }

}
